﻿using Ewelve_Four_HD.BLL;
using Ewelve_Four_HD.DAL;
using Ewelve_Four_HD.Model;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Ewelve_Four_HD.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UserController : ControllerBase
    {
        private readonly UserBll userBll;

        public UserController(UserBll _userBll)
        {
            userBll = _userBll;
        }
        /// <summary>
        /// 用户添加
        /// </summary>
        /// <param name="X"></param>
        [HttpPost]
        /// <returns></returns>
        public int UserAdd(UserInfo X)
        {
            try
            {
                return userBll.UserAdd(X);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="Password"></param>
        /// <returns></returns>
        [HttpGet]
        public dynamic UserLog(string UserName, string Password)
        {
            try
            {
                return userBll.UserLog(UserName, Password);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
